package model;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class FileTxtReader implements FileTypeReader{

	@Override
	public String getContent(final String fileName) throws IOException {
		
		final File file = new File(fileName);
		final FileReader reader = new FileReader(file);
		final BufferedReader bufferedReader = new BufferedReader(reader);
		final StringBuffer content = new StringBuffer();
		
		String text;
		try {
			while ((text = bufferedReader.readLine() ) != null){
				content.append(text).append(System.getProperty("line.seperator"));
			}
		} finally {
			reader.close();
			bufferedReader.close();
		}
		
		
		return content.toString();
	}
	
	

}
